#!/bin/bash
#SBATCH -J rw_serial
#SBATCH --partition long
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 8
#SBATCH --time 500:00:00

# source /opt/intel/impi/4.0.3.008/bin64/mpivars.sh

# source /opt/intel/impi/4.0.3.008/intel64/bin/mpivars.sh // mpi!!!!

LD_LIBRARY_PATH=/opt/intelruntime/11.1.072/intel64/:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

# mpicc -cc=icc -o rw_mpi rw_mpi.c src/genmtrand.c src/rw_functions.c src/rw_png.c -lm -lpng -std=c99 -O3 -Wall -openmp
# icc -o main main.c src/genmtrand.c src/rw_functions.c src/rw_png.c -lm -lpng -std=c99 -O3 -Wall -openmp

# cd $SLURM_SUBMIT_DIR
# mkdir exec-$SLURM_JOBID
# cp mpi_pi exec-$SLURM_JOBID
# cd exec-$SLURM_JOBID

# para o mpi
# export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi.so
# export I_MPI_FABRICS=dapl

echo "--------------------------------------"
ldd main
echo "--------------------------------------"
ulimit -s unlimited
ulimit -a
echo "--------------------------------------"

date

for i in $(seq 1 10)
do
	./main 2 1024 2048 "$i" 1 >> reduction/saida_1024_2048_OpenMP_1T_CACAU_Reduction
done

for i in $(seq 1 10)
do
	./main 2 2048 4096 "$i" 1 >> reduction/saida_2048_4096_OpenMP_1T_CACAU_Reduction
done

for i in $(seq 1 10)
do
	./main 2 4096 8192 "$i" 1 >> reduction/saida_4096_8192_OpenMP_1T_CACAU_Reduction
done

date

